package jnpf.zc.entity;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import jnpf.zc.model.zcglzcdjinfo.ZcglZcdjInfoInfoPoiDTO;
import lombok.Data;

import java.util.Date;
/**
 *
 * 资产登记权证信息
 * @版本： V3.2.0
 * @版权： 智果云科技（https://www.jnpfsoft.com）
 * @作者： JNPF开发平台组
 * @日期： 2024-12-19
 */
@Data
@TableName("zcgl_zcdj_warrant")
public class ZcglZcdjWarrantEntity  {
    @TableId("F_ID")
    private String id;

    @TableField("F_CREATORUSERID")
    private String creatoruserid;

    @TableField("F_CREATORTIME")
    private Date creatortime;

    @TableField("F_DESCRIPTION")
    private String description;

    @TableField("F_PARENTID")
    private String parentId;

    @TableField("PROPERTY_RIGHT")
    private String propertyRight;

    @TableField("WARRANT_NUMBER")
    private String warrantNumber;

    @TableField("LAND_USE")
    private String landUse;

    @TableField("HOUSE_PURPOSE")
    private String housePurpose;

    @TableField("ZZ_PROPERTY_OWNER")
    private String zzPropertyOwner;

    @TableField("XZ_PROPERTY_OWNER")
    private String xzPropertyOwner;

    @TableField("ADDRESS")
    private String address;

    @TableField("USE_NATURE")
    private String useNature;

    @TableField("BUILDINGS")
    private Integer buildings;

    @TableField("LAYERS")
    private Integer layers;

    @TableField("NUMBER_FLOORS")
    private Integer numberFloors;

    @TableField("START_TIME")
    private Date startTime;

    @TableField("END_TIME")
    private Date endTime;

    @TableField("ISSUANCE_TIME")
    private Date issuanceTime;

    @TableField("CUSTODY_LOCATION")
    private String custodyLocation;

    @TableField("NOTES")
    private String notes;

    @TableField("PRODUCTION_IMAGE")
    private String productionImage;

    @TableField("PRODUCTION_FILE")
    private String productionFile;

    @TableField("CHANGE_TIME")
    private Date changeTime;

    @TableField("CHANGE_REASON")
    private String changeReason;

    @TableField("WARRANT_TYPE")
    private String warrantType;

    @TableField("WARRANT_UNIT")
    private String warrantUnit;

    @TableField("PROPERTY_RIGHT_DESCRIBE")
    private String propertyRightDescribe;

    /** 权证类型 **/
    @TableField("WARRANT_STYLE")
    private String warrantStyle;

    /** 其他权证类型说明 **/
    @TableField("WARRANT_STYLE_DESCRIBE")
    private String warrantStyleDescribe;

    /** 是否可以办理0可以不办理1无法办理 **/
    @TableField("CAN_HANDLE")
    private String canHandle;

    /** 需要哪些部门配合完善权属 **/
    @TableField("DEPARTMENTS")
    private String departments;

    /** 下一步措施 **/
    @TableField("NEXT_STEPS")
    private String nextSteps;

    // 闲置起始时间
    @JsonFormat( pattern = "yyyy-MM-dd")
    @TableField("IDLE_START_TIME")
    private Date idleStartTime;

    // 闲置原因
    @TableField("IDLE_REASON")
    private String idleReason;

    // 拟利用方式
    @TableField("PROPOSED_METHOD")
    private String proposedMethod;

    // 预计实现利用率
    @TableField("ESTIMATED_RATE")
    private String estimatedRate;

    // 计划完成时限
    @TableField("PLANNED_DATE")
    @JsonFormat( pattern = "yyyy-MM-dd")
    private Date plannedDate;

    public ZcglZcdjWarrantEntity () {

    }

    public ZcglZcdjWarrantEntity (ZcglZcdjInfoInfoPoiDTO dto) {
        this.parentId = dto.getId();
        this.useNature = dto.getUseNature();
        this.custodyLocation = dto.getCustodyLocation();
        this.warrantNumber = dto.getWarrantNumber();
        this.propertyRight = dto.getPropertyRight();
        this.propertyRightDescribe = dto.getPropertyRightDescribe();
        this.warrantType = dto.getWarrantType();
        this.warrantStyleDescribe = dto.getWarrantStyleDescribe();
        if(StrUtil.isNotEmpty(dto.getIssuanceTime())){
            this.issuanceTime = DateUtil.parse(dto.getIssuanceTime());
        }
        if(StrUtil.isNotEmpty(dto.getEndTime())){
            this.endTime = DateUtil.parse(dto.getEndTime());
        }
        if(StrUtil.isNotEmpty(dto.getStartTime())){
            this.startTime = DateUtil.parse(dto.getStartTime());
        }
    }
}
